﻿using System.Collections.Generic;
using UnityEngine;
using GraphProcessor;

namespace IQIGame.Onigao.GamePlay.Editors
{
    [System.Serializable, NodeMenuItem(LevelEditorConst.Level + "/" + LevelEditorConst.Prefab + "/" + LevelEditorConst.Execution, typeof(LevelServiceGraph))]
    public class LevelServiceExecutionPrefabNode : IDGenerateNode
    {
        public override bool isRenamable => true;
        public override Color color => new Color(1f, 0.85f, 0.7f);

        [Output("执行", false)] public LevelServiceEditor execution;
        public override string name => LevelEditorConst.Execution + LevelEditorConst.Prefab;

        public string prefabkey;

        protected override void Process()
        {
            base.Process();
            var rPrefabSource = new EditorLevelServiceExecPrefabSource()
            {
                key = this.prefabkey,
                executions =  new List<EditorLevelServiceExecutionConfig>()
            };
            this.execution = new LevelServiceEditor()
            {
                executionPrefab = rPrefabSource
            };
            LevelServiceBlackboard.Instance.AddExectuionPrefab(rPrefabSource);
        }
    }
}